package com.jftone.bh.app.action;

import com.jftone.bh.app.service.StatiService;
import org.apache.log4j.Logger;
import org.jftone.annotation.Autowired;
import org.jftone.annotation.Controller;
import org.jftone.exception.ActionException;
import org.jftone.util.IData;
import org.jftone.util.StringUtil;

import java.util.List;


@Controller(mapping="/statiAction")
public class StatiAction extends BaseAction {

	private Logger logger = Logger.getLogger(StatiAction.class);
	
	@Autowired
	private StatiService service;

	public void index() throws ActionException {
		try {
			this.render("stati/stati_index.html");
		} catch (Exception e) {
			logger.error("查询统计错误" + e.getMessage(), e);
			throw new ActionException("查询统计错误" + e.getMessage(), e);
		}
	}

	public void queryStatiData() throws ActionException {
		IData<String, Object> data = getData();
		String userId = data.getString("userId", "");
		String sTime = data.getString("sTime", "");
		String eTime = data.getString("eTime", "");
		try {
			this.send(service.queryStatiData(userId,sTime,eTime));
		} catch (Exception e) {
			logger.error("查询统计错误" + e.getMessage(), e);
			throw new ActionException("查询统计错误" + e.getMessage(), e);
		}
	}

}
